﻿//#define VERBOSE

using RayDen.RayEngine.Core;
using RayDen.RayEngine.Core.Interface;
using RayDen.RayEngine.Managers;

namespace RayDen.RayEngine.Engines.PhotonMapping {


    public class PhotonMappingRenderThread : DeviceRenderThread<PhotonPathBuffer>
    {

        private PhotonMappingContext Context; //TODO 1 Engine per thread limitation!!

        public PhotonMappingRenderThread(int index,
                                   IIntersectionEngine device,
                                   RayEngineScene scn,
                                   bool lowLatency,
                                   IImageFilm pixelDevice,
                                   PhotonMappingContext ctx,
                                   SamplingContext sc, IFrameManager frameManager)
            : base(index, scn)
        {
            this.frameManager = frameManager;
            DeviceRenderBufferCount = 1;
            Context = ctx;
            this.Init(device, lowLatency, pixelDevice, sc);
        }

        protected override PhotonPathBuffer CreatePathBuffer(int maxPath, RayEngineScene scene, IImageFilm pixelDevice, SamplingContext sc)
        {
            var buffer = base.CreatePathBuffer(maxPath, scene, pixelDevice, sc);
            buffer.Context = this.Context;
            return buffer;
        }

    }
}
